#!/bin/bash

function compile {
    SM3_HOME=$PWD
    SM3_SRC=$SM3_HOME/src
    SM3_BIN=$SM3_HOME/bin
    SM3_CLASS=$SM3_HOME/class

	echo $SM3_SRC
    rm -rf $SM3_SRC/sources.list
    find $SM3_SRC -name "*.java" > $SM3_SRC/sources.list
    cat  $SM3_SRC/sources.list

    rm -rf $SM3_CLASS
    mkdir $SM3_CLASS

    #javac -d $SM3_CLASS  -encoding utf-8  -sourcepath $SM3_SRC @$SM3_SRC/sources.list
	javac -d $SM3_CLASS  -sourcepath $SM3_SRC @$SM3_SRC/sources.list
    rm -f $SM3_HOME/bin/sm3.jar
    cd $SM3_CLASS
    jar -cvfm $SM3_HOME/bin/sm3.jar $SM3_HOME/MANIFEST.MF *
    chmod a+x  $SM3_HOME/bin/sm3.jar
}

compile
exit 0
